package io.renren.modules.lucky.service.impl;

import io.renren.common.validator.Assert;
import io.renren.modules.lucky.entity.AppSysLogoEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.lucky.dao.AppSysModelDao;
import io.renren.modules.lucky.entity.AppSysModelEntity;
import io.renren.modules.lucky.service.AppSysModelService;

@Service("appSysModelService")
public class AppSysModelServiceImpl extends ServiceImpl<AppSysModelDao, AppSysModelEntity> implements AppSysModelService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<AppSysModelEntity> page = this.page(
                new Query<AppSysModelEntity>().getPage(params),
                new QueryWrapper<AppSysModelEntity>()
        );
        return new PageUtils(page);
    }

    public List<AppSysModelEntity> getSysModelByType(String modelType) {
        List<AppSysModelEntity> list = baseMapper.selectList(new QueryWrapper<AppSysModelEntity>()
                .eq("model_type", modelType).eq("model_flag", 1));
        Assert.isNull(list, "主页角标为空");
        return list;
    }

}